from django_redis import get_redis_connection
class MyRedis:
    def __init__(self):
        self.redis=get_redis_connection(alias='default')
    def setcode(self,phone,code):
        self.redis.setex(phone,60*2,code)

    def getcode(self,phone):
        self.redis.get(phone)



redis_tool=MyRedis()